package com.dd.admin.business.sellJson.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.common.model.PageFactory;
import com.dd.admin.business.sellJson.entity.Selljson;
import com.dd.admin.business.sellJson.mapper.SelljsonMapper;
import com.dd.admin.business.sellJson.service.SelljsonService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.dd.admin.business.sellJson.domain.SelljsonVo;
import com.dd.admin.business.sellJson.domain.SelljsonDto;
import java.util.List;

import static com.dd.admin.business.pay.enmus.PayConst.PENDING_SELL_COMPLETE;

/**
 * <p>
 * 订单json 服务实现类
 * </p>
 *
 * @author 727869402@qq.com
 * @since 2024-06-19
 */
@Service
public class SelljsonServiceImpl extends ServiceImpl<SelljsonMapper, Selljson> implements SelljsonService {

    @Override
    public IPage<SelljsonVo> selectSelljsonPage(SelljsonDto sellJsonDto) {
        Page page = PageFactory.defaultPage();
        return baseMapper.selectSelljsonPage(page,sellJsonDto);
    }

    @Override
    public List<SelljsonVo> selectSelljsonList(SelljsonDto sellJsonDto) {
        return baseMapper.selectSelljsonList(sellJsonDto);
    }

    @Override
    public void completePendingSell(String jsonId) {
        Selljson selljson = new Selljson();
        selljson.setJsonId(jsonId);
        selljson.setPendingStatus(PENDING_SELL_COMPLETE);
        this.updateById(selljson);
    }
}
